package io.sage.modules.integral.enums;

/**
 * 积分来源.
 */
public enum IntegralType {
	
	SIGN_IN(0, "每日签到积分"),
	STORM_A_PASS(1, "闯关积分"),
	EXAM(2, "考试积分"),
	SIMULATION_EXAM(3, "模拟考试积分"),
	SYSTEM(99, "系统积分");

    private Integer code;
    private String message;

    /**
     * 根据code获取message
     * @param code
     * @return
     */
    public static String getMessage(Integer code){
        for (IntegralType examEnum : IntegralType.values()){
            if (code.equals(examEnum.getCode()) || code == examEnum.getCode()){
                return examEnum.getMessage();
            }
        }
        return null;
    }

	private IntegralType(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
	
	public Integer getCode() {
		return code;
	}
	
	public void setCode(Integer code) {
		this.code = code;
	}
	
	public String getMessage() {
		return message;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}

}
